<?php

declare(strict_types=1);

namespace app\validate\order;

use think\Validate;

class ShipmentCompanyValidate extends Validate
{
    protected $rule = [
        'id' => 'integer|gt:0',
        'name' => 'max:120',
        'code' => 'max:60',
        'contact_phone' => 'max:30',
        'contact_email' => 'email',
        'website' => 'max:255',
        'tracking_url' => 'max:255',
        'delivery_type' => 'in:express,freight,self',
        'support_cod' => 'in:0,1',
        'api_type' => 'max:50',
        'status' => 'in:0,1',
        'sort' => 'integer|egt:0',
    ];

    protected $scene = [
        'create' => [
            'name',
            'code',
            'contact_phone',
            'contact_email',
            'website',
            'tracking_url',
            'delivery_type',
            'support_cod',
            'api_type',
            'api_config',
            'required_fields',
            'status',
            'sort',
        ],
        'update' => [
            'id',
            'name',
            'code',
            'contact_phone',
            'contact_email',
            'website',
            'tracking_url',
            'delivery_type',
            'support_cod',
            'api_type',
            'api_config',
            'required_fields',
            'status',
            'sort',
        ],
    ];
}
